﻿using System;
using kunukn.RecommendationEngine.AreaRecommendation.Code.Entities;
using kunukn.RecommendationEngine.AreaRecommendation.Code.Helpers;
using kunukn.RecommendationEngine.AreaRecommendation.Code.Web;

namespace kunukn.RecommendationEngine.AreaRecommendation.Controls
{
    /// <summary>
    /// Author: Kunuk Nykjaer
    /// </summary>
    public partial class UserView : MyControl
    {                
        public bool EnableEdit { get; set; } 

        protected void Page_Load(object sender, EventArgs e)
        {                        
            btnClearViewedItems.Visible = EnableEdit;
            UserId.Text = string.Format("UserId: {0}", SessionHelper.GetUserId());            
            ViewedThisSession.Text = HtmlHelper.ViewedItemsThisSession_Html();            
        }
                      
        protected void btnClearViewedItems_Click(object sender, EventArgs e)
        {
            SessionHelper.ResetViewedItems();

            //reload page
            Server.Transfer(Request.Path);
        }
    }
}